// #include "atcoder/all"
#include <bits/stdc++.h>
using ll = long long;
const int MOD1000000007 = 1000000007;
const int MOD998244353 = 998244353;
const double PI = 3.14159265358979323846264338327950288;
void solve();
int main()
{
// std::ios_base::sync_with_stdio(false);
// std::cin.tie(0);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int testcase = 1;
// scanf("%d", &testcase);
while (testcase--)
solve();
return 0;
}
const int N = 2e4 + 5;
int grid[N][20];
int send[N][20], receive[20];
void solve()
{
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
scanf("%d", &grid[i][j]);
}
}
while (k--)
{
int x, y;
scanf("%d%d", &x, &y);
send[x][y]++;
receive[y]++;
}
for (int i = 1; i <= n; i++)
{
int ans = 0;
for (int j = 1; j <= m; j++)
{
if (grid[i][j])
{
ans += receive[j];
ans -= send[i][j];
}
}
printf("%d ", ans);
}
printf("\n");
}
145. Binary Tree Postorder Traversal | 94. Binary Tree Inorder Traversal |
101. Symmetric Tree | 77. Combinations |
46. Permutations | 226. Invert Binary Tree |
112. Path Sum | 1556A - A Variety of Operations |
136. Single Number | 169. Majority Element |
119. Pascal's Triangle II | 409. Longest Palindrome |
1574A - Regular Bracket Sequences | 1574B - Combinatorics Homework |
1567A - Domino Disaster | 1593A - Elections |
1607A - Linear Keyboard | EQUALCOIN Equal Coins |
XOREQN Xor Equation | MAKEPAL Weird Palindrome Making |
HILLSEQ Hill Sequence | MAXBRIDGE Maximise the bridges |
WLDRPL Wildcard Replacement | 1221. Split a String in Balanced Strings |
1002. Find Common Characters | 1602A - Two Subsequences |
1555A - PizzaForces | 1607B - Odd Grasshopper |
1084A - The Fair Nut and Elevator | 1440B - Sum of Medians |